import { observable, action } from 'mobx';

class CommendList {
	@observable list_data = [];
	@action async getFetchList() {
		let that = this;
		await fetch('http://zongwu.top/biaoguo-api/commend_list/', {
			headers: {
				"Content-Type": "application/json",
			},
			method: "GET",
		})
		.then((response) => {
			return response.json();
		}).then((jsonData) => {
			let arr = [];
			jsonData.map((data) => {
				return arr.push(Object.assign({}, {key: data.id}, data));
			})
			that.list_data = arr;
		}).catch((err) => {
			console.log(err);
		})
	}
}

const commend_list_data = new CommendList();
export default commend_list_data;